<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
if(!$this->request->isAjax() || !is_pjax())
	$this->need('header.php'); ?>
<title><?php $this->archiveTitle(array(
		'category'  =>  _t('分类：%s'),
		'search'    =>  _t('搜索：%s'),
		'tag'       =>  _t('标签：%s'),
		'author'    =>  _t('%s 发布的文章')
	), '', ' - '); ?><?php $this->options->title(); ?></title>
<div id="wrapper" class="clearfix">
	<div id="margin-body" class="body">
		<div class="main">
			<div class="page-title no-margin">
				<ul>
					<li <?php if($this->is('index')): ?>class="active"<?php endif; ?>><a href="<?php $this->options->siteUrl(); ?>">最新</a></li>
					<?php if($this->is('post')): ?>
						<li class="active">
							<?php $categories = $this->categories;
							if($categories):
								?>
								<a href="<?php _e($categories[0]['permalink']); ?>"><?php _e($categories[0]['name']); ?></a>
							<?php endif; ?>
						</li>
					<?php endif; ?>
					<?php if($this->is('archive')):?>
						<li class="active">
							<a href="javascript:jBlog.goTop();"><?php _e($this->getArchiveTitle()); ?></a>
						</li>
					<?php endif; ?>
					<li><a href="javascript:jBlog.ajaxGetExplore();" title="<?php _e('随机显示一篇文章');?>"><?php _e('探索');?></a></li>
					<li class="page-search">
						<form id="search" method="post" action="./" role="search">
							<label for="s" class="sr-only"><?php _e('搜索关键字'); ?></label>
							<input type="text" name="s" class="text" placeholder="<?php _e('输入关键字搜索'); ?>" />
							<button type="submit" class="submit" title="<?php _e('搜索'); ?>"><i class="fa fa-search"></i></button>
						</form>
					</li>
				</ul>
			</div>
			<div class="main-inner">
				<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
					<div class="post-header">
						<?php if (!empty($this->options->Show) && in_array('author', $this->options->Show)): ?>
							<div class="post-author clearfix">
								<?php if ($this->options->post_author == '1'): ?>
									<a class="avatar fleft" href="<?php $this->author->permalink(); ?>"><img class="post-avatar" width="48" src="<?php if ($this->options->avatarUrl): ?><?php $this->options->avatarUrl() ?><?php else: ?><?php $this->options->themeUrl('img/avatar.jpg'); ?><?php endif; ?>" alt="" /></a>
								<?php endif; ?>
								<?php if ($this->options->post_author == '2'): ?>
									<a class="avatar fleft" href="<?php $this->author->permalink(); ?>"><img width="48" src="<?php echo Tools_Plugin::gravatarUrl($this->author->mail,48); ?>" alt="" /></a>
								<?php endif; ?>
								<p><span class="label"><?php _e('作者');?></span> <a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a> <?php _e('于');?> <span title="<?php _e('最后编辑于');echo date('Y.m.d H:i:s',$this->modified); ?>"><?php $this->date('Y.m.d H:i:s'); ?></span> <?php _e('发布在');?> <?php $this->category(','); ?></p>
								<?php if ($this->options->comment == 'comments_duoshuo'): ?>
									<p><?php _e('最后编辑于');echo date('Y.m.d H:i:s',$this->modified); ?></p>
								<?php endif; ?>
								<?php if ($this->options->comment == 'comments'): ?>
									<p><?php _e('写了%d篇文章,',$this->author->postsNum);?><?php _e('回复%d人',$this->author->commentsNum);?></p>
								<?php endif; ?>
							</div>
						<?php endif; ?>
						<h2 class="post-title"><?php $this->title() ?></h2>
						<div class="post-meta">
							<a href="<?php $this->permalink() ?>"><?php _e('阅读：'); $this->viewsNum(); ?></a><em>·</em>
							<?php if ($this->options->comment == 'comments'): ?>
								<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论：%d'); ?></a><em>·</em>
							<?php endif; ?>
							<?php if ($this->options->comment == 'comments_duoshuo'): ?>
								<a href="<?php $this->permalink() ?>" class="ds-thread-count" data-thread-key="<?php $this->cid(); ?>"></a><em>·</em>
							<?php endif; ?>
							<span><?php _e('喜欢：'); $this->likesNum(); ?></span>
						</div>
					</div>
					<div class="post-content">
						<?php $this->content(); ?>
					</div>
					<?php if (!empty($this->options->Show) && in_array('favatar', $this->options->Show)): ?>
						<div class="post-fauthor">
							<div class="author-favatar"><img src="<?php if ($this->options->avatarUrl): ?><?php $this->options->avatarUrl() ?><?php else: ?><?php $this->options->themeUrl('img/avatar.jpg'); ?><?php endif; ?>" /></div>
							<p><?php $this->options->tips(); ?></p>
						</div>
					<?php endif; ?>
					<?php if (!empty($this->options->Show) && in_array('tags', $this->options->Show)): ?>
						<div class="post-tags"><?php _e('标签: '); ?><?php $this->tags(', ', true, 'none'); ?></div>
					<?php endif; ?>
					<div class="post-tool">
						<a class="btn-like" href="javascript:void(0);" data-cid="<?php $this->cid();?>" title="<?php $this->likesNum();?>"><i class="fa fa-heart-o"></i> 赞 | <span><?php $this->likesNum();?></span></a>
						<a class="btn-donate"  href="javascript:void(0);">赏</a>
					</div>
				</article>

				<?php $this->need($this->options->comment.'.php'); ?>
			</div><!-- end #main-->
		</div><!-- end #main-->
	</div><!-- end #body -->
	<script>
		function jBlogInit() {
			jBlog.initPjax({
				url:'<?php $this->options->siteUrl();?>',
				action:'<?php $this->options->index('action');?>',
				current:'<?php echo $this->getArchiveType();?>',
				prefix:'<?php echo md5($this->options->rootUrl);?>',
			});
		}
	</script>
</div><!-- end #wrapper -->
<?php
if(!$this->request->isAjax() || !is_pjax())
	$this->need('footer.php'); ?>
